<style type="text/css">
    .matrix-lable-left {
        text-align-last: left
    }

    .add-need-panel .matrix-div-left {
        width: 50px;
        float: left;
        padding-top: 7px;
    }

    .add-need-panel .matrix-div-right {
        margin-left: 50px;
    }

    .add-need-panel .bootstrap-touchspin {
        width: 90%;
    }
    .matrix-rzslider-title {
        margin-top: 16px;
    }
</style>
<accordion ng-if="isVisible">
    <!-- <accordion-group heading="PDM评审  (变更日期：{{$ctrl.need.pdmEndDate|date: 'yyyy-MM-dd'}})" is-open="true"> -->
    <accordion-group is-open="$ctrl.info.statusOpen" is-disabled="isDisabled">
        <accordion-heading>
            需求确认  (变更日期：{{$ctrl.need.pdmEndDate|date: 'yyyy-MM-dd'}})
            <i class="pull-right fa fa-angle-right" ng-class="{'fa-angle-down': $ctrl.info.statusOpen, 'fa-angle-right': !$ctrl.info.statusOpen}"></i>
            <i class="fa fa-edit" ng-click="pdmEdit()" title="编辑"
               ng-if="isCommited&&isAdmin"></i>
        </accordion-heading>



        <!--可编辑模块-->
        <div class="col-sm-12 form-horizontal add-need-panel" ng-if="!isCommited">
            <div class="form-group matrix-lable-left">
                <label class="col-sm-1 control-label ">负&nbsp;&nbsp;责&nbsp;&nbsp;人 <span style="color: red;">*</span>：</label>
                <div class="col-sm-2">
                    <ui-select
                               multiple ng-model="$ctrl.need.needPdm"
                               theme="bootstrap"
                               close-on-select="false"
                               readonly="$ctrl.info.isAffirmed">
                        <ui-select-match placeholder="请设置PDM负责人" readonly="$ctrl.info.isAffirmed">{{$item.realname}}</ui-select-match>
                        <ui-select-choices repeat="i in $ctrl.pdmList | filter:$select.search | limitTo:15"
                                           ng-disabled="isPdmAble">
                            {{i.realname}}
                        </ui-select-choices>
                    </ui-select>
                </div>
                <label class="col-sm-1 control-label"> </label>
            </div>
            <div class="form-group matrix-lable-left">
                <label class="col-sm-1 control-label">需求类型 <span style="color: red;">*</span>：</label>
                <div class="col-sm-8" style="margin-top: 5px;">
                    <span ng-repeat="pdmBrdType in $ctrl.info.pdmBrdTypes" readonly="">
                      <label ng-disabled="isPdmAble" class="btn btn-xs btn-rounded"
                             ng-class="$ctrl.need.pdmNeedType==pdmBrdType.key ? 'btn-info' : 'btn-default'"
                             ng-model="$ctrl.need.pdmNeedType" btn-radio="pdmBrdType.key"
                             uncheckable
                             style="border: 1px solid #dee5e7;">{{pdmBrdType.value}}</label>
                      &nbsp;&nbsp;&nbsp;&nbsp;
                    </span>
                </div>
            </div>
            <div class="form-group matrix-lable-left" style="margin-top: 10px;">
                <label class="col-sm-1 control-label">需求回退：</label>
                <div class="col-sm-1" style="width: 40px">
                    <label class="i-switch m-t-xs m-r">
                        <input type="checkbox" ng-model="$ctrl.need.pdmIsReturn" ng-true-value="true"
                               ng-false-value="false" ng-disabled="isPdmAble"
                               ng-change="switchFallback($ctrl.need.pdmIsReturn)"
                               >
                        <i></i>
                    </label>
                </div>
                <div ng-if="$ctrl.need.pdmIsReturn" class="col-sm-8" style="margin-top: 5px;">

                        <span ng-repeat="rtn in $ctrl.info.returns">
                            <label ng-disabled="isPdmAble"
                                    ng-class="rtn.check ? 'btn btn-info btn-sm btn-rounded' : 'btn btn-default btn-sm btn-rounded'"
                                   ng-model="rtn.check"
                                   ng-click="selecRtn(rtn)"
                                   uib-btn-checkbox ng-disabled="isPdmAble"
                                    readonly="$ctrl.info.isAffirmed">{{rtn.value}}</label>
                        </span>
                </div>
            </div>
            <div class="form-group matrix-lable-left" ng-if="$ctrl.need.pdmIsReturn">
                <label class="col-sm-1 control-label">用户故事：</label>
                <div class="col-sm-4" >
                    <m-ui-select prompt="请选择用户故事"
                                 itme-list="$ctrl.info.issues"
                                 selected-item="$ctrl.info.selIsuue"
                                 select-item-fun="selectIssueItem(item)"
                                 has-disabled="isPdmAble"
                                 >
                    </m-ui-select>
                </div>
                <div class="col-sm-2">
                    <button class="btn btn-default" ng-click="addReturnIssue()"  ng-disabled="isPdmAble">引入</button>
                </div>
            </div>
            <div class="form-group matrix-lable-left" ng-if="$ctrl.need.pdmIsReturn">
                <label class="col-sm-1 control-label">选择的用户故事：</label>
                <div>
                    <span ng-show="$ctrl.info.tipsIssue" style="color: red">至少选择一个用户故事</span>
                    <span ng-repeat="item in $ctrl.info.returnIssues track by $index "
                          ng-show="!$ctrl.info.tipsIssue">
                        <a ng-show="!isPdmAble"
                           ng-click="openNeedModal(item)">{{item.content}}</a>
                        <span ng-show="isPdmAble" >{{item.content}}</span>
                    </span>
                </div>
            </div>

            <div class="form-group matrix-lable-left">
                <label class="col-sm-1 control-label">需求完成：</label>
                <div class="col-sm-1" style="width: 40px">
                    <label class="i-switch m-t-xs m-r" readonly="$ctrl.info.isAffirmed">
                        <input type="checkbox" ng-model="$ctrl.need.isComplete" ng-true-value="true"
                               ng-false-value="false" ng-disabled="isPdmAble"
                               ng-change="switchComplete($ctrl.need.isComplete)"
                        >
                        <i></i>
                    </label>
                </div>
                <div ng-if="$ctrl.need.isComplete" class="col-sm-8" style="margin-top: 5px;">
                    <span ng-repeat="ret in $ctrl.info.completes">
                      <label class="'btn btn-xs btn-rounded" style="padding-right: 10px ; border: 1px solid #dee5e7;"
                             ng-class="$ctrl.need.completeReason == ret.key ? 'btn-info' : 'btn-default'"
                             ng-model="$ctrl.need.completeReason" btn-radio="ret.key" uncheckable
                             ng-disabled="isPdmAble">{{ret.value}}</label>
                    </span>
                </div>
            </div>
            <div class="form-group matrix-lable-left" ng-hide="$ctrl.need.pdmIsReturn || $ctrl.need.isComplete">
                <label class="col-sm-1 control-label" for="req-desc">需求明确时间：</label>
                <div class="col-sm-8">
                    <m-datepicker select-dt="$ctrl.need.pdmClearTime" is-disabled="isPdmAble"></m-datepicker>
                </div>
            </div>
            <div class="form-group matrix-lable-left">
                <label class="col-sm-1 control-label"
                      >备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注
                <span
                        style="color: red;">*</span>：</label>
                <div class="col-sm-8">
                    <textarea class="form-control" rows="5" ng-model="$ctrl.need.pdmDesc"
                              ng-disabled="isPdmAble"></textarea>
                </div>
            </div>
            <div class="form-group matrix-lable-left" ng-hide="$ctrl.need.pdmIsReturn || $ctrl.need.isComplete">
                <label class="col-sm-1 control-label" for="req-desc">优&nbsp;&nbsp;先&nbsp;&nbsp;级：</label>
                <div class="col-sm-2">
                    <winit-priority-rzslider data="$ctrl.need.pdmPriority" is-disabled="isPdmAble"></winit-priority-rzslider>
                </div>
            </div>
            <div class="form-group matrix-lable-left" ng-hide="$ctrl.need.pdmIsReturn || $ctrl.need.isComplete">
                <label class="col-sm-1 control-label" for="req-desc">人工数：</label>
                <div class="form-group matrix-lable-left">
                    <div class="col-sm-1" style="width: 3%;padding-top:7px;text-align: right;">
                        PDM
                    </div>
                    <div class="col-sm-1">
                        <winit-text-number number-data="$ctrl.need.pdmCount" number-max="100"
                                               is-disabled="isPdmAble"></winit-text-number>
                    </div>
                    <div class="col-sm-1" style="width: 3%;padding-top:7px;text-align: left;">
                        人
                    </div>
                    <div class="col-sm-1" style="width: 5%;padding-top:7px;text-align: right;">
                        前端
                    </div>
                    <div class="col-sm-1">
                            <winit-text-number number-data="$ctrl.need.uiCount" number-max="100"
                                               is-disabled="isPdmAble"></winit-text-number>
                    </div>
                    <div class="col-sm-1" style="width: 3%;padding-top:7px;text-align: left;">
                        人
                    </div>
                    <div class="col-sm-1" style="width: 5%;padding-top:7px;text-align: right;">
                        后台
                    </div>
                    <div class="col-sm-1">
                            <winit-text-number number-data="$ctrl.need.devCount" number-max="100"
                                               is-disabled="isPdmAble"></winit-text-number>
                    </div>
                    <div class="col-sm-1" style="width: 3%;padding-top:7px;text-align: left;">
                        人
                    </div>
                    <div class="col-sm-1" style="width: 5%;padding-top:7px;text-align: right;">
                        测试
                    </div>
                    <div class="col-sm-1">
                            <winit-text-number number-data="$ctrl.need.qaCount" number-max="100"
                                               is-disabled="isPdmAble"></winit-text-number>
                    </div>
                    <div class="col-sm-1" style="width: 3%;padding-top:7px;text-align: left;">
                        人
                    </div>
                </div>
            </div>
            <div class="form-group matrix-lable-left" ng-hide="$ctrl.need.pdmIsReturn || $ctrl.need.isComplete">
                <label class="col-sm-1 control-label" for="req-desc">时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;长：</label>
                <div class="form-group matrix-lable-left">
                    <div class="col-sm-2">
                        <winit-text-number number-data="$ctrl.need.cycle" number-max="100" is-disabled="isPdmAble"></winit-text-number>
                        <!-- <winit-cycle-rzslider data="$ctrl.need.cycle" is-disabled="isPdmAble"></winit-cycle-rzslider> -->
                    </div>
                    <div class="col-sm-2">
                        <m-ui-select prompt="请选择" itme-list="$ctrl.info.cycleStatus" selected-item="$ctrl.need.sltCycleStatus" has-disabled="isPdmAble"></m-ui-select>
                    </div>
                </div>
            </div>
            <div class="form-group" ng-hide="$ctrl.need.pdmIsReturn || $ctrl.need.isComplete">
                <div class="form-group">
                    <label class="col-sm-2 control-label">总时间：<span ng-bind="$ctrl.showNumner()"></span> 个人日</label>
                    <label class="col-sm-2 control-label">参考成本：<span ng-bind="$ctrl.cost"></span>元</label>
                    <label class="col-sm-2 control-label">参考价值：<span ng-bind="$ctrl.refValue*10000"></span>元</label>
                    <label class="col-sm-2 control-label">投入产出比：<span ng-bind="$ctrl.costLowerFee()"></span></label>
                    <label class="col-sm-2 control-label">同季度机会成本：1.2</label>
                </div>
            </div>

            <div class="form-group" >
                <label class="col-sm-3  matrix-rzslider-title i-checks i-checks-sm" ng-if="!isCommited">
                    <input type="checkbox" ng-checked="$ctrl.info.isEnded"
                           ng-model="$ctrl.info.isEnded"
                           ng-click="prepareCommit($ctrl.info.isEnded)"
                           style="font-size: small"
                    >
                    <i></i>
                    作为pdm评审人我已经确定需求
                </label>

                <button class="btn btn-default "
                        ng-click="pdmAffirm()"
                        ng-if="!isCommited"
                        ng-disabled="!$ctrl.info.isEnded"
                >
                    需求确认</button>
            </div>
        </div>



        <!--只读模块-->
        <div class="col-sm-12 form-horizontal add-need-panel" ng-if="isCommited">
            <div class="form-group matrix-lable-left">
                <label class="col-sm-1 control-label ">负&nbsp;&nbsp;责&nbsp;&nbsp;人：</label>
                <label class="col-sm-10 control-label">{{$ctrl.need.needPdmNames}}</label>
            </div>
            <div class="form-group matrix-lable-left">
                <label class="col-sm-1 control-label">需求类型：</label>
                <label class="col-sm-10 control-label">{{$ctrl.need.pdmNeedTypeStr}}</label>
            </div>
            <div class="form-group matrix-lable-left"  ng-if="$ctrl.need.isFallback=='1'">
                <label class="col-sm-1 control-label">需求回退：</label>
                <label class="col-sm-10 control-label">{{$ctrl.need.isFallback=="1"?"是":"否"}}</label>
            </div>
            <div  class="form-group matrix-lable-left"  ng-if="$ctrl.need.isFallback=='1'">
                <label class="col-sm-1 control-label">回退理由：</label>
                <label class="col-sm-10 control-label">{{$ctrl.need.fallbackReason}}</label>
            </div>

            <div class="form-group matrix-lable-left" ng-if="$ctrl.need.isComplete=='1'">
                <label class="col-sm-1 control-label">需求完成：</label>
                <label class="col-sm-10 control-label">{{$ctrl.need.isComplete=="1"?"已完成":"未完成"}}</label>
            </div>

            <div class="form-group matrix-lable-left" ng-if="$ctrl.need.isComplete=='1'">
                <label class="col-sm-1 control-label">完成理由:</label>
                <label class="col-sm-10 control-label">{{$ctrl.need.completeReason=="SVN_MANAGEMENT"?"SVN管理方案":"沙箱环境迁移方案"}}</label>
            </div>

            <div class="form-group matrix-lable-left">
                <label class="col-sm-1 control-label" for="req-desc">需求明确时间：</label>
                <label class="col-sm-10 control-label">{{$ctrl.need.pdmClearTimeStr}}</label>
            </div>
            <div class="form-group matrix-lable-left">
                <label class="col-sm-1 control-label"
                >备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注：</label>
                <label class="col-sm-10 control-label">{{$ctrl.need.pdmDesc}}</label>
            </div>
            <div class="form-group matrix-lable-left" ng-hide="$ctrl.need.pdmIsReturn || $ctrl.need.isComplete">
                <label class="col-sm-1 control-label" >优&nbsp;&nbsp;先&nbsp;&nbsp;级：</label>
                <label class="col-sm-10 control-label">{{$ctrl.need.pdmPriorityStr}}</label>

            </div>
            <div class="form-group matrix-lable-left" ng-hide="$ctrl.need.pdmIsReturn || $ctrl.need.isComplete">
                <label class=" col-sm-1 control-label" >人工数：</label>
                    <label class=" control-label" >PDM</label>
                    <label>{{$ctrl.need.pdmCount}}人</label>
                    <label class=" control-label" >前端</label>
                    <label>{{$ctrl.need.uiCount}}人</label>
                    <label class=" control-label" >后台</label>
                    <label>{{$ctrl.need.devCount}}人</label>
                    <label class=" control-label" >测试</label>
                    <label>{{$ctrl.need.qaCount}}人</label>
            </div>
            <div class="form-group matrix-lable-left" ng-hide="$ctrl.need.pdmIsReturn || $ctrl.need.isComplete">
                <label class="col-sm-1 control-label" for="req-desc">时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;长：</label>
                <label class="control-label">{{$ctrl.need.cycle}}{{$ctrl.need.sltCycleStatus.crtname}}</label>
            </div>
            <div class="form-group" ng-hide="$ctrl.need.pdmIsReturn || $ctrl.need.isComplete">
                <div class="form-group">
                    <label class="col-sm-2 control-label">总时间：<span ng-bind="$ctrl.showNumner()"></span> 个人日</label>
                    <label class="col-sm-2 control-label">参考成本：<span ng-bind="$ctrl.cost"></span>元</label>
                    <label class="col-sm-2 control-label">参考价值：<span ng-bind="$ctrl.refValue*10000"></span>元</label>
                    <label class="col-sm-2 control-label">投入产出比：<span ng-bind="$ctrl.costLowerFee()"></span></label>
                    <label class="col-sm-2 control-label">同季度机会成本：1.2</label>
                </div>
            </div>
        </div>






    </accordion-group>
</accordion>